#pragma once
#include "Import.h"

using namespace TJs;

#define SAFE_RELEASE(pObj) \
	if(pObj) pObj->Release(); \
	pObj = NULL;

struct SDeviceConfig
{
	enum ZFuncType{
		eZFunc_LessEqual
	};

	int			iAdapterIndex;

	HWND		hWnd;
	int			iWndWidth;
	int			iWndHeight;

	bool		bZEnable;
	bool		bZWriteEnable;
	ZFuncType	eZFuncType;

	//VS
	//fillmode
	//shademode
	//cullmode
	//antialias
};

class CDx9Device : public Core::Object
{
	IDirect3D9* m_pD3D;
	

	SDeviceConfig		m_cfg;
private:

public:

	IDirect3DDevice9*	m_pD3DDevice;




	CDx9Device();
	~CDx9Device();

	bool Initialize(SDeviceConfig& aConfig);
	void ResetRenderState();

	bool BeginScene();
	bool EndScene();
};

extern CDx9Device* CreateEngineDevice(SDeviceConfig& aConfig);